<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateVoiceCallHangupTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('voice_call_hangup', function (Blueprint $table) {
            $table->integerIncrements('id');
            $table->integer('user_id')->default(0)->comment('挂断用户ID');
            $table->integer('chat_user_id')->default(0)->comment('被挂断用户ID');
            $table->integer('call_id')->default(0)->comment('话单记录ID');
            $table->tinyInteger('call_from')->default(0)->comment('话单记录来源');
            $table->timestamps();
            $table->tinyInteger('flag')->default(1)->comment('状态');
            $table->index('user_id', 'user_id');
            $table->index('chat_user_id', 'chat_user_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('voice_call_hangup');
    }
}
